package com.zhangjh.web.filter;

import java.io.IOException;
import java.util.Date;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import org.springframework.stereotype.Component;
@Component
public class TiemFliter implements Filter{

	@Override
	public void destroy() {
		System.out.println("--------------->>destroy");
	}

	@Override
	public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain chain)
			throws IOException, ServletException {
		System.out.println("--------------->>doFilter");
		long start = new Date().getTime();
		chain.doFilter(arg0, arg1);
		System.out.println("耗时："+(new Date().getTime()-start));
		
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		System.out.println("--------------->>init");
	}

}
